package com.arofoxmsn.utils;

public class FlashMessage {
	
	public enum Type{OK,ERROR,WARNING,DELIVERED};
	
	private int code;
	private String description;
	
	public FlashMessage(){}
	
	public FlashMessage(int code, String description) {
		super();
		this.code = code;
		this.description = description;
	}
	
	public FlashMessage(Type type, String description) {
		super();
		this.setCode(type);
		this.description = description;
	}
	
	public void setData(Type type, String description) {
		this.setCode(type);
		this.description = description;
	}
	
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	
	public Type getCodeType() {
		switch(code){
			case 1:
				return Type.OK;
			case 2:
				return Type.ERROR;
			case 3:
				return Type.WARNING;
			case 4:
				return Type.DELIVERED;
			default:
				return null;
		}
	}
	public void setCode(Type type) {
		switch(type){
		case OK:
			this.code = 1;
			break;
		case ERROR:
			this.code = 2;
			break;
		case WARNING:
			this.code = 3;
			break;
		case DELIVERED:
			this.code = 4;
			break;
		}
	}
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	public void printFlash(){
		System.out.println(this.getCode());
		System.out.println(this.getDescription());
	}
}
